<?php
include('jxc_inc_head.php');
$tag='product';
$id=$wu->request_int('id');
if($wu->request_string('act')=='del' && $id){
        $db->delete('tproductgoods',"ID=$id");
        $wu->redirect('删除成功','product_list.php?tag='.$tag);
}
$w=$wu->request_string('w');
?>
<div class="btns"><a href="jxc_product_edit.php?tag=product">添加产品</a></div>
<form method="post" action="#">
    <input type="text" name="w" value="<?php echo $w; ?>" /><input type="submit" value="搜索" /><input type="hidden" name="act" value="search" />
</form>
<table cellpadding="0" cellspacing="0" border="1">
	<tr><th>摘要信息</th><th>统计信息</th><th>操作</th></tr>
	<?php
                $sqlcid=$w?' a.Name like \'%'.$w.'%\' and ':'';			
                $pager=new pagerhelper();
                $pager->setquery("tproductgoods a left join tgeneralcatalog b on a.CatalogID=b.ID where $sqlcid a.ExTags='$tag'",'a.*,b.Name as CatalogName','a.CreatedTime desc');
		if($pager->recordset){
			$i=1;
			foreach($pager->recordset as $row){
				echo '<tr><td><b>序号</b>'.$i.'<br /><b>名称：</b>'.$row['Name'].'<br /><b>分类：</b>'.$row['CatalogName'].'<br /><b>售价：</b>'.$row['Price'].'</td><td><b>库存：</b>'.$row['Stock'].'<br /><b>销量：</b>'.$row['SaleVolume'].'<br /><b>浏览量：</b>'.$row['VisitCount'].'</td><td class="btns"><a href="product_edit.php?tag='.$tag.'&id='.$row['ID'].'">编辑</a><a href="?tag='.$tag.'&act=del&id='.$row['ID'].'">删除</a> <a href="jxc_productlog_list.php?id='.$row['ID'].'">进销记录</a> <a href="jxc_productlog_edit.php?id='.$row['ID'].'">进货</a><a href="article_list.php?tag=knowledge&itemid='.$row['ID'].'" target="_blank">知识库</a></td></tr>';
				$i++;
			}
		}
	?>
</table>
<div class="pager"><?php echo $pager->get_pagerbar(); ?></div>
<?php
	include('jxc_inc_foot.php');
?>
